// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
// 引入路由
import VueRouter from 'vue-router'
import Routes from './routes'
// 引入element-ui
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

// 引入axios
// import axios from 'axios'
// axios.defaults.baseURL = 'https://wd7995297966yjuctj.wilddogio.com/'


// 全局创建自定义指令 rainbow
Vue.directive('rainbow',{
    //el 绑定的元素
    //binding
    //vnode
    bind(el,binding,vnode){
        el.style.color = '#'+333;
        // el.style.color = '#' + Math.random().toString(16).slice(2,8);
    }
})
Vue.directive('theme',{
    bind(el,binding,vnode){
        if(binding.value == 'wide'){
            el.style.width = '800px';
        }else if (binding.value == 'narrow'){
            el.style.width = '600px';
        }
        if(binding.arg == 'column'){
            // el.style.background = '#6677cc';
        }
    }
})

// 全局过滤器
Vue.filter('to-uppercase',function (value) {
    return value.toUpperCase();
})

Vue.config.productionTip = false
// 使用路由
Vue.use(VueRouter)
// 使用element-ui
Vue.use(ElementUI);

// 创建路由实例
const router = new VueRouter({
    routes : Routes,
    linkActiveClass:'active',
    mode:'history'
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
